﻿using LiteBlog.Common.Entities;
using LiteBlog.Repositories.Contracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LiteBlog.Components.SiteMap
{
    internal class CategoryProvider : ISiteMapProvider
    {
        private ICategoryRepository _categoryRepository;
        internal CategoryProvider(ICategoryRepository categoryRepo)
        {
            _categoryRepository = categoryRepo;
        }
        public IEnumerable<SiteMapUrl> GetSiteMapItems()
        {
            return _categoryRepository.Get()
                .Select(category => new SiteMapUrl
                {
                    Location = "/" + category.CatID,
                    LastModifiedTime = DateTime.UtcNow
                });
        }
    }
}
